#include"searcher.hpp"
#include<iostream>
#include<string>
#include"util.hpp"
#include<cstring>

#define BUFFERSIZE 1024

const std::string src_path = "data/parse_html/parse.txt";


int main()
{
    ns_searcher::Searcher* search = new ns_searcher::Searcher();
    //检测相关性与boost官网是否一样
    //打印出我们在id:7330文档中，jieba分割的关键词
     search->InitSearcher(src_path);
    std::string query;
    std::string json_str;
    while(true)
    {
        std::cout << "Please Enter Your Query# ";
        char buffer[BUFFERSIZE];
        fgets(buffer,sizeof(buffer)-1,stdin);
        buffer[strlen(buffer)-1] = 0;
        query = buffer;
        search->Search(query,&json_str);
        std::cout << json_str << std::endl;
    }
    
    return 0;
}